<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/11/14 0014
 * Time: 15:50
 */
namespace plugins\qbt_wx_os\model;//Demo插件英文名，改成你的插件英文就行了
use think\Model;
class WxOsGMenuModel extends Model{
    protected $name = 'wx_os_g_menu';

    public function data_list(){
        return $this->alias('g')
            ->field('g.*,p.provincial as p_name')
             ->join('qbtcmf_wx_os_provincial p','p.pid = g.pid')
            ->order('g.add_time desc')
            ->paginate(10);
    }

    public function data_info($where){
        return $this->alias('g')
            ->field('g.*,p.provincial as p_name,c.city as c_name')
            ->join('qbtcmf_wx_os_city c','c.cid = g.cid')
            ->join('qbtcmf_wx_os_provincial p','p.pid = g.pid')
            ->where('c.pid = g.pid')
            ->where($where)
            ->find();
    }

    public function data_info1($where){
        return $this->where($where)->find();
    }

    public function add_data($data){
        return $this->insertGetId($data);
    }

    public function update_data($where,$data){
        return $this->where($where)->update($data);
    }

    public function del_data($where){
        return $this->where($where)->delete();
    }
}